#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
int main()
{
    pid_t k;
    k = fork();
    if (k < 0)
    {
        printf("fork error!\n");
        exit(-1);
    }
    else if (k == 0)
    {
        /*子进程*/
        printf("parent %d , child %d \n", getppid(), getpid());
        execl("./test", "./test", "1234", "hello", NULL);
        printf("in child after execl .\n");
        exit(88);
    }
    else
    {
        /*父进程*/
        pid_t y;
        int status;
        y = waitpid(k, &status, 0);
        printf("parent %d , child %d , exit code is : %d\n", getpid(), y, WEXITSTATUS(status));
    }
}
